package com.commpany.servie.basic.clickhistory.business.read.clickHistory.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.commpany.jdq.core.orm.Pagination;
import com.commpany.servie.basic.clickhistory.business.read.clickHistory.ClickHistoryReadManage;
import com.commpany.servie.basic.clickhistory.dao.read.ClickHistoryReadDAO;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jdq.core.common.PageResult;
import com.commpany.jdq.core.common.BaseReadManager;
import com.commpany.servie.basic.clickhistory.po.ClickHistoryPO;
@Slf4j
@Service
public class ClickHistoryReadManageImpl extends BaseReadManager<ClickHistoryPO> implements ClickHistoryReadManage {
	@Autowired
	private ClickHistoryReadDAO clickHistoryReadDAO;
	
	@Override
    public ClickHistoryPO getClickHistoryService(ClickHistoryPO po){
                 checkParams(po);
         return  clickHistoryReadDAO.findById(po);
    }
    @Override
	public PageResult<ClickHistoryPO> selectClickHistoryPageService(ClickHistoryPO po, Pagination page){
	       checkParams(po);
	    page.setLimitStart((page.getPageNo() - 1) * page.getPageSize());
		PageResult<ClickHistoryPO> result = new PageResult<ClickHistoryPO>();
		List<ClickHistoryPO> list = clickHistoryReadDAO.findOfPage(po, page);
		int count = clickHistoryReadDAO.countOfPage(po);
		result.setList(list);
		result.setTotalSize(count);
		result.copy(page);
		return result;
		
	}
	
    @Override
	public int countClickHistoryService( ClickHistoryPO po ){
	            checkParams(po);
	    return clickHistoryReadDAO.countOfPage(po);
	
	}
	
    @Override
	public List<ClickHistoryPO> queryClickHistoryService(ClickHistoryPO po){
	            checkParams(po);
	   return  clickHistoryReadDAO.findAll(po);
	}
	
}
	